<template>
    <select class="lang-change" v-model="lang">
        <option value="zh_CN">简体中文</option>
        <option value="zh_TW">繁体中文</option>
        <option value="en_US">English</option>
    </select>
</template>

<script>
    export default {
        name: "lang",
        created(){
            if(this.$storage.get("?lang")){
                this.lang = this.$storage.get("lang");
            }
        },
        activated(){
            if(this.$storage.get("?lang")){
                this.lang = this.$storage.get("lang");
            }
        },
        data(){
            return {
                lang: "zh_CN"
            }
        },
        watch: {
            "lang": function () {
                this.$storage.set("lang",this.lang);
                this.$i18n.locale = this.lang
            }
        }
    }
</script>
